revXMLPutIntoNode
Type
command
Summary
Sets the contents of a node in an XML tree.
Syntax
revXMLPutIntoNode <treeID>, <nodePath>, <newContents> [, <replaceTextOnly>]
Description
Use the revXMLPutIntoNode command to put data into a node, between the node's start and end tags.
To put Unicode text into a node, first use the uniDecode function to encode the text as UTF-8:
revXMLPutIntoNode the docId of field \"xmltree\",selectedNode,
uniDecode(the unicodeText of field \"Contents\" ,\"UTF8\")
The revXMLPutIntoNode command is part of the XML library. To ensure that the command works in a standalone application, you must include this custom library when you create your standalone. In the Inclusions pane of the Standalone Application Settings window, make sure the "XML" checkbox is checked.
Parameters
Name | Type | Description |
---|---|---|
treeID | The number returned by the revXMLCreateTree or revXMLCreateTreeFromFile function when you created the XML tree. | |
nodePath | The path to the node whose contents you want to set. | |
newContents | The text that the node will contain. | |
replaceTextOnly | The replaceTextOnly specifies whether to keep child nodes or not. If replaceTextOnly is true then all text in the specified node is replaced with newContents, but all child nodes are preserved. Otherwise all child nodes are removed. The replaceTextOnly parameter is optional, and if not given, defaults to false. |
Examples
revXMLPutIntoNode 12,"/Article/Author","Jane Li"
revXMLPutIntoNode myCurrentNode,dataPaths["current"],field "Data", true
Related
function: result, uniDecode, revXMLCreateTree, revXMLCreateTreeFromFile
glossary: XML tree, Standalone Application Settings, tag, standalone application, Unicode, node, command, LiveCode custom library
library: XML library
command: revXMLDeleteNode, revXMLAppend
Compatibility and Support
Introduced
LiveCode 2.0
OS
mac
windows
linux
ios
android
Platforms
desktop
server
mobile